Skip to content

monitoring: agent + tool-call OTel spans for Maple (tool_origin attribution) - #5

Merged
IEatCodeDaily merged 10000 commits into
mainfrom
feat/monitoring-maple-traces
Nov 15, 2026
Merged

IEatCodeDaily merged 10000 commits into
mainfrom
feat/monitoring-maple-traces

Conversation

@IEatCodeDaily

Copy link
Copy Markdown
Owner

Instrument Hermes agent activity into Maple via OTel (Raisal, 2026-11-14): session/turn lifecycle spans plus every tool call — Executor tools included — with a strict content-free allowlist.

What exists vs what this adds

The fleet line already carries the agent-trace plane (agent/monitoring/agent_traces.py + gateway/agent_trace_emit.py): session/turn/tool spans over the monitoring bus, pseudonymized correlation ids, per-kind attribute allowlists, GenAI semconv dual-emit, TTL sweep for abandoned spans, OFF by default behind monitoring.agent_traces.enabled + monitoring.export.otlp.{enabled,endpoint,headers_env}. Producers bind at the two real seams: admitted turn execution (trace_execution at the turn facade) and the single tool dispatch point (trace_tool in tool_executor) — so every tool call (native, MCP, Executor) already produces start/end spans with tool name, call id, duration, status/error and session/turn/model correlation.

This PR adds the one missing attribute: AgentToolExecEvent.tool_origin — "native" or "mcp:<server>" (Executor calls arrive as mcp:executor), derived from the mcp__<server>__<tool> naming convention at dispatch, appended to the wire shape (never reordered), allowlisted into the span, redact_bounded applies. No prompts, arguments, results or secrets enter the plane — the charter is untouched and tested.

Export target

monitoring.export.otlp stays operator-configured by design; the Maple endpoint and the OpenBao-held ingest key are deployment config per fleet host (asked from the Maple cutover thread rather than invented here). Sender mechanics per the Maple deployment: OTLP HTTP to the LAN Caddy origin /v1/traces, headers_env mapping an env var to the authorization header (env value carries the full Bearer <key>), service.name=hermes-gateway (or per-host), deployment.environment.name=prod. Talos first; fleet rollout only after Talos validation; no gateway restart without Raisal.

Executor coverage note

The Executor itself is a distroless upstream container we can't instrument without forking it. Coverage at the Hermes MCP/tool-call layer gives complete executor-tool tracking: every executor call is a mcp:executor tool span with name, duration, ok/error and session/turn correlation, parented under the turn span. Per-executor-address attribution rides the MCP server name today; a registry lookup for instance addresses is a small follow-up if wanted.

Lane

Branch carries the fleet live state on top of fork main (same pattern as #2/#4 — the fleet serving trees run this line). Focused gate: branch-only workflow monitoring-maple-traces.yml running the monitoring + trace-producer regressions. Local verification: py_compile + plain-python smoke (wire order, allowlist entry, origin derivation).

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.